<template>
  <div>
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>
          <i class="el-icon-lx-calendar"></i>全局配置
        </el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="container">
      <div class="form-box">
        <el-form ref="form" :model="form" label-width="200px">
          <el-form-item label="注册人赠送积分">
            <el-input v-model="form.registerGainIntegral"></el-input>
          </el-form-item>
          <el-form-item label="推荐人赠送积分">
            <el-input v-model="form.registerGainShareIntegral"></el-input>
          </el-form-item>
          <el-form-item label="次级推荐人赠送积分">
            <el-input v-model="form.registerGainShareIntegral2"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onSubmit()">表单提交</el-button>
            <el-button>取消</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
import { api } from "@/api/index";
export default {
  name: "baseform",
  inject: ["reload"],
  data() {
    return {
      form: {
        initIntegral: '',
        initPrice: '',
        maxShop: '',
        maxShopCount: '',
        outPrice: '',
      },
    };
  },
  mounted() {
    this.getData();
  },
  methods: {
    getData() {
      api('/web/systemConfig/g', {
        limit: 1,
        offset: 1,
      }).then((res) => {
        this.form = res.data.rows[0];
      });
    },
    onSubmit() {
      api('/web/systemConfig/u', this.form).then((res) => {
        if (res.code === 2000) {
          this.$message.success(res.message);
          this.reload();
        } else {
          this.$message.error(res.message);
        }
      });
    },
  },
  created() { },
};
</script>
<style scoped>
.pre-img {
  width: 100px;
  height: 100px;
  background: #f8f8f8;
  border: 1px solid #eee;
  border-radius: 5px;
}

.crop-demo {
  display: flex;
  align-items: flex-end;
}

.crop-input {
  position: absolute;
  width: 102px;
  height: 102px;
  left: 0px;
  top: 0px;
  opacity: 0;
  cursor: pointer;
}
</style>